package com.zbf.枚举and包装;

/**
 * @author: LI-CI-GAO
 * 作者: licigao
 * 日期: 2021/8/14  10:45
 * 描述:
 */
public enum TestEnum {

    /**
     * 作者: LI-CI-GAO
     * 日期: 2021/8/14  10:47
     * 描述: 出库
     * @Param 
     * @Return 
     */
    YICHUKU(100,"出库"),

    /**
     * 作者: LI-CI-GAO
     * 日期: 2021/8/14  10:47
     * 描述: 收货
     * @Param 
     * @Return 
     */
    YISHOUHUO(200,"收货");


    private int code;

    private String msg;

    TestEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }


    public static TestEnum getFromCode(int code){

        for (TestEnum testEnum : TestEnum.values()) {
            if(code==testEnum.getCode()){
              return testEnum;
            }
        }

        return null;
    }




}
